//
//  NGHomeTabBarController.m
//  NgTopOSShove
//
//  Created by yscompany on 2018/11/19.
//  Copyright © 2018 NgTopOS. All rights reserved.
//

#import "NGHomeTabBarController.h"
#import "Mine/NgMineViewController.h"
#import "HomePage/NgHomepageViewController.h"
#import "GeneralInfo/NgBaseNavigationController.h"

@interface NGHomeTabBarController ()

@end

@implementation NGHomeTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    NgHomepageViewController *homePageVC = [NgHomepageViewController new];
    [self setupChildViewController:homePageVC title:@"首页" imageName:@"ysttabbarshouyenormal" selectedImageName:@"ysttabbarshouyeselect"];
    NgMineViewController *mineVC = [NgMineViewController new];
    [self setupChildViewController:mineVC title:@"我" imageName:@"ysttabbarminenormal" selectedImageName:@"ysttabbarmineselect"];
    // Do any additional setup after loading the view.
}
-(void) setupChildViewController:(UIViewController *)childVc title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName {
    childVc.title = title;
    childVc.tabBarItem.image = [[UIImage imageNamed:imageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    childVc.tabBarItem.selectedImage = [[UIImage imageNamed:selectedImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    childVc.tabBarItem.imageInsets = UIEdgeInsetsMake(-2, 0, 2, 0);
    childVc.tabBarItem.titlePositionAdjustment = UIOffsetMake(0, -5);
    NgBaseNavigationController *nav = [[NgBaseNavigationController alloc] initWithRootViewController:childVc];
    nav.title = title;
    
    [self addChildViewController:nav];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
